popover: Get rid of a gtk_widget_get_allocation call
authorTimm Bäder <mail@baedert.org>
Sun, 12 Aug 2018 11:44:35 +0000 (13:44 +0200)
committerTimm Bäder <mail@baedert.org>
Thu, 29 Nov 2018 07:50:18 +0000 (08:50 +0100)
Use _compute_bounds instead.

gtk/gtkpopover.c

index 36c2db858e1817281420e8844d38f06e37cbb886..c58d6c05bf7f2b038b7947554139f1f396fbf34c 100644 (file)
@@ -331,19 +331,17 @@ gesture_released (GtkGestureMultiPress *gesture,
                   GtkPopover           *popover)
 {
   GtkPopoverPrivate *priv = gtk_popover_get_instance_private (popover);
-  GtkAllocation child_alloc;
+  graphene_rect_t child_bounds;
   GtkWidget *child;
 
   if (!priv->button_pressed)
     return;
 
   child = gtk_bin_get_child (GTK_BIN (popover));
-  gtk_widget_get_allocation (child, &child_alloc);
+  gtk_widget_compute_bounds (child, GTK_WIDGET (popover), &child_bounds);
 
-  if (x < child_alloc.x ||
-      x > child_alloc.x + child_alloc.width ||
-      y < child_alloc.y ||
-      y > child_alloc.y + child_alloc.height)
+  if (!graphene_rect_contains_point (&child_bounds,
+                                     &(graphene_point_t){x, y}))
     gtk_popover_popdown (popover);
 }